/* 
 * CMPS 258: Programming Languages
 *        Assignment 2 - Part2: "Spy" - March 24, 2008
 *        Group name: Doomsday
 *        Authors:  Ramsey Nasser (ID# 200600496) 
 *                  Hadi Abu Rislan (ID# 200600426) 
 *                  Kevin Azzam (ID# 200602033)
 * 
 * Definition of path data structure and related functions.
 * 
 * A path is a set of joined edges.
 */
#ifndef PATH_H_
#define PATH_H_

#include "graph.h"

/*
 * A path within the graph
 */
typedef struct _path {
	int size;			// How many steps in the path
	int root;			// The ID of the root vertex
	struct _graph* graph;		// The graph this path is on.
	struct _edge** steps;		// Each step on the path.
} path;

/*
 * Allocate space for a new path.
 */
path* path_init(struct _graph* g, int root);

/*
 * Clone a path.
 */
path* path_clone(path* p);

/*
 * Determine whether or not path p contains the vertex v.
 */
BOOL path_contains(path* p, int v);

/*
 * Append a vertex to the path.
 * 
 * Returns true if the vertex is a valid next step, false otherwise.
 */
BOOL path_append(path* p, int v);

/*
 * Print out a path.
 */
void path_print(path* p);

/*
 * Check if a path is broken.
 */
BOOL path_is_broken(path* p);

/*
 * Get the step with the highest frequency.
 */
struct _edge* path_get_most_frequent_step(struct _path* p);

#endif /*PATH_H_*/
